/*
 * @Description: jishupu-admin-template
 * @Author: 技术铺<jishupu@qq.com>
 * @Date: 2022-03-03
 */
const { success } = require('./utils')

// 友情链接模块
module.exports = [
  // 列表
  {
    url: '/v1/links$',
    type: 'get',
    response: config => {
      const result = {
        'items': [
          {
            'id': 3,
            'type': 1,
            'name': '技术铺官网',
            'logo_image': [],
            'href': 'http://www.jishupu.com',
            'href_target': '_blank',
            'rel': '',
            'partner': '',
            'partner_linkman': '',
            'partner_phone_number': '',
            'sort': 999,
            'status': 1,
            'created_at': '2022-02-28 14:55:21',
            'updated_at': '2022-03-01 20:32:04'
          },
          {
            'id': 2,
            'type': 2,
            'name': 'https://vuejs.org/',
            'logo_image': [
              {
                'id': 5,
                'name': 'Snipaste_2022-02-28_14-34-30.png',
                'description': '',
                'path': 'static/img/demo/6QdvsDuKqPX1WfdqDnKkB58bf05ANzXEZHf5KXsE.png',
                'url': 'http://localhost:9527/static/img/demo/6QdvsDuKqPX1WfdqDnKkB58bf05ANzXEZHf5KXsE.png'
              }
            ],
            'href': 'https://vuejs.org/',
            'href_target': '_blank',
            'rel': '',
            'partner': '',
            'partner_linkman': '',
            'partner_phone_number': '',
            'sort': 999,
            'status': 1,
            'created_at': '2022-02-28 14:54:57',
            'updated_at': '2022-02-28 14:54:57'
          },
          {
            'id': 1,
            'type': 1,
            'name': 'Element',
            'logo_image': [],
            'href': 'https://element.eleme.cn',
            'href_target': '_blank',
            'rel': '',
            'partner': '',
            'partner_linkman': '',
            'partner_phone_number': '',
            'sort': 999,
            'status': 1,
            'created_at': '2022-02-28 14:54:28',
            'updated_at': '2022-02-28 14:54:28'
          }
        ],
        'meta': {
          'current_page': 1,
          'last_page': 1,
          'per_page': '20',
          'total': 3
        }
      }
      return success(result)
    }
  },
  // 详情
  {
    url: '/v1/links/\\d+$',
    type: 'get',
    response: config => {
      const result = {
        'id': 3,
        'type': 1,
        'name': '技术铺',
        'logo_image': [],
        'href': 'http://www.jishupu.com',
        'href_target': '_blank',
        'rel': '',
        'partner': '',
        'partner_linkman': '',
        'partner_phone_number': '',
        'sort': 999,
        'status': 1
      }
      return success(result)
    }
  },
  // 添加
  {
    url: '/v1/links$',
    type: 'post',
    response: config => {
      return success({}, '添加成功')
    }
  },
  // 修改
  {
    url: '/v1/links/\\d+$',
    type: 'put',
    response: config => {
      return success({}, '修改成功')
    }
  },
  // 模拟修改状态
  {
    url: '/v1/links/\\d+/status',
    type: 'patch',
    response: config => {
      return success({}, '修改成功')
    }
  },
  // 模拟删除
  {
    url: '/v1/links/\.*',
    type: 'delete',
    response: config => {
      return success({}, '删除成功')
    }
  },
  // 模拟排序
  {
    url: '/v1/links/sort',
    type: 'put',
    response: config => {
      return success({}, '修改成功')
    }
  }
]
